class Response {
  static code = {
    success: 'success', //成功
    fail: 'fail', //失败
    noPermiren: 'noPermiren', //权限不足
    paramNotFound: 'paramNotFound', //参数不全
    paramError: 'paramError', //参数格式不正确
    dbError: 'dbError', //数据库错误
    genalError: 'genalError' //一般错误
  };

  static error(ctx, code, msg) {
    ctx.body = {
      code: code,
      msg: msg
    };
  }

  static success(ctx, data) {
    ctx.body = {
      code: this.code.success,
      data: data
    };
  }
}

exports = module.exports = Response;
